package com.woniu.smallmedical.controller;

import com.woniu.smallmedical.entity.TreeMenu;
import com.woniu.smallmedical.entity.User;
import com.woniu.smallmedical.server.TreeMenuServer;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author author
 * @create 2021-09-26-8:59
 */
@CrossOrigin
@RestController
public class TreeMenuController {
    @Autowired
    TreeMenuServer treeMenuServer;

    @RequestMapping("/treemenus")
    public List<TreeMenu> getTreeMenu(){
        List<TreeMenu> treeMenu = treeMenuServer.getTreeMenu();
        return treeMenu;
    }

    @RequestMapping("/treemenu")
    public User getTreeMenuByRid(User user){
        User treeMenu = treeMenuServer.getTreeMenuBySid(user.getSid());
        return treeMenu;
    }
}
